﻿@{
    //success messages
    var successMessages = new List<string>();
    if (TempData[string.Format("nop.notifications.{0}", NotifyType.Success)] != null)
    {
        successMessages.AddRange(TempData[string.Format("nop.notifications.{0}", NotifyType.Success)] as IList<string>);
    }
    if (ViewData[string.Format("nop.notifications.{0}", NotifyType.Success)] != null)
    {
        successMessages.AddRange(ViewData[string.Format("nop.notifications.{0}", NotifyType.Success)] as IList<string>);
    }


    //error messages
    var errorMessages = new List<string>();
    if (TempData[string.Format("nop.notifications.{0}", NotifyType.Error)] != null)
    {
        errorMessages.AddRange(TempData[string.Format("nop.notifications.{0}", NotifyType.Error)] as IList<string>);
    }
    if (ViewData[string.Format("nop.notifications.{0}", NotifyType.Error)] != null)
    {
        errorMessages.AddRange(ViewData[string.Format("nop.notifications.{0}", NotifyType.Error)] as IList<string>);
    }
}
@*TODO use "displayPopupNotification" java-script function*@
@if (successMessages.Count > 0)
{
    <script type="text/javascript">
        $(document).ready(function () {
            $("#dialog-notifications-success").dialog({ modal: true });
        });
    </script>
}
@if (errorMessages.Count > 0)
{
    <script type="text/javascript">
        $(document).ready(function () {
            $("#dialog-notifications-error").dialog({ modal: true });
        });
    </script>
}
<div id="dialog-notifications-success" title="@T("Common.Notification")" style="display:none;">
    @foreach (var message in successMessages)
    {
        <p>@message</p>
    }
</div>
<div id="dialog-notifications-error" title="@T("Common.Error")" style="display:none;">
    @foreach (var message in errorMessages)
    {
        <p>@message</p>
    }
</div>
<div id="bar-notification" class="bar-notification">
    <img src="@Url.Content("~/Content/Images/ico-close-notification-bar.png")" class="close" alt="Close" title="Close" />
</div>
@Html.Widget("notifications")
